package com.forezp.service;

import com.forezp.dao.TaskNodeDao;
import com.forezp.entity.TaskNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * springboot-jdbc-DataSourceService
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/3/16 14:16
 */
@Service
public class TaskNodeService {

    @Autowired
    private TaskNodeDao taskNodeDao;

    public List<TaskNode> getAll() {
        return taskNodeDao.findAll();
    }

    public List<TaskNode> findByTaskIdOrderByOrderDesc(Integer taskId) {
        return taskNodeDao.findByTaskIdOrderByOrderValueDesc(taskId);
    }

    public void save(TaskNode taskNode) {
        this.taskNodeDao.save(taskNode);
    }

    public TaskNode findById(Integer taskNodeId) {
        return this.taskNodeDao.findOne(taskNodeId);
    }

    public void del(Integer taskNodeId) {
        this.taskNodeDao.delete(taskNodeId);
    }

    public List<TaskNode> findByTaskId(Integer id) {
        return taskNodeDao.findByTaskId(id);
    }
}
